<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/5/15
 * Time: 9:40
 */


use Doctrine\Common\Cache\FilesystemCache;

//require_once __DIR__."/../../conn.php";
require_once __DIR__."/../../include/config.inc.php";
require_once __DIR__.'/../../include/vendor/autoload.php';

class RichesmeAppRedis
{
    static private $instance = null;
    private $caches = null;
    private $prefix = '';
    private $scope = '';

    private function __construct($scope)
    {
//        $this->caches = new FilesystemCache(__DIR__ . '/caches');
//        $this->scope = $scope;
//        $this->prefix = 'catch-' . $this->scope . '-';
//        $this->caches->setNamespace($this->scope);
    }


    public static function getInstance($scope='api')
    {
        if (self::$instance == null) {
            self::$instance = new Predis\Client();
            global $redis_db;
            self::$instance->select($redis_db);

        }
        return self::$instance;
    }

}